﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace VerticalSpiderEditor
{
    public static class VerticalSpiderXmlHelper
    {
        private static Type[] _Types;

        public static Type[] Types
        {
            get
            {
                if (_Types == null)
                    _Types = Assembly.Load("InternetSpiderLib").GetTypes();

                return _Types;
            }
        }

        public static List<string> GetCoincidentalTypeNames(Type type)
        {
            var typeNames = new List<string>();

            foreach (var item in Types)
            {
                if (item.IsAbstract || item.IsInterface)
                    continue;

                if (type.IsAssignableFrom(item))
                {
                    typeNames.Add(TypeHelper.GetTypeFullName(item));
                }
            }
            return typeNames;
        }
    }
}
